<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>司机展示</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">销售方</a>
            <a>
              <cite>司机</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block">
                            <input class="layui-input" autocomplete="off" placeholder="请输入姓名" name="driverName"
                                   id="driverName">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input class="layui-btn" type="text" id="bu1" value="确定">
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    <button class="layui-btn" onclick="xadmin.open('添加用户','./noticetypeadd.html',800,600)"><i
                            class="layui-icon"></i>添加
                    </button>
                    <button class="layui-btn" onclick="xadmin.open('修改用户','./noticetypeupdate.html',800,600)"><i
                            class="layui-icon"></i>修改
                    </button>
                    <button class="layui-btn" onclick="xadmin.open('更新用户状态','./noticetypeupdatestate.html',800,600)"><i
                            class="layui-icon"></i>更新状态
                    </button>
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>会员号</th>
                            <th>司机姓名</th>
                            <th>联系方式</th>
                            <th>认证时间</th>
                            <th>更新时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="text3"></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script src="lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script>

    document.getElementById("bu1").onclick = function () {
        var list = {
            "pageNo": 1,
            "pageSize": 10,
            "driverName": document.getElementById("driverName").value,
        };
        var lists = JSON.stringify(list);
        $.ajax({
            type: 'post',
            url: 'http://localhost:5500/driver/selectDriver',
            data: lists,
            contentType: "application/json; charset=utf-8",
            success: function (data) {
                console.log(data);

                var table = $("#text3");
                table.empty();
                for (var i = 0; i < data.data.records.length; i++) {
                    //拼接表格的行和列
                    var str = "<tr><td>" + data.data.records[i].id + "</td><td>" + data.data.records[i].name + "</td><td >" + data.data.records[i].phoneNumber + "</td><td>" + data.data.records[i].addTime + "</td><td>" + data.data.records[i].updateTime + "</td><td>" + data.data.records[i].state + "</td></tr>";
                    table.append(str);
                }
            }, error: function (e) {//响应不成功时返回的函数
                console.log(e, 'error');
            }
        });
    };
</script>
</html>